package io.gitee.yanbinchen;

import java.lang.reflect.Method;

/**
 * @author: alex
 * @since : 2025-03-04 19:37
 */
public class AbstractSuperCache {
    public String getCacheKey(SuperKey superKey, Method method, Object[] args) {
        if (StrUtils.isNotEmpty(superKey.key())) {
            return superKey.value() + SpelUtils.getKeyByExpression(method, args, superKey.key());
        } else {
            return superKey.value();
        }
    }

    public String getCacheKey(DelSuperKey delSuperKey, Method method, Object[] args) {
        if (StrUtils.isNotEmpty(delSuperKey.key())) {
            return delSuperKey.value() + SpelUtils.getKeyByExpression(method, args, delSuperKey.key());
        } else {
            return delSuperKey.value();
        }
    }
}
